-
Notifications
You must be signed in to change notification settings - Fork 381
Create Plane from Location #1912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Create Plane from Location #1912
Conversation
Otherwise creating of Plane from tuple of int does not work anymore due to introduced @multimethod
Instead of just creating a temporary plane and rotating it
multimethod did not work, as that disallows keyword arguments for construction of Plane, which ruins many tests multidispatch works with keyword arguments, but looks horrible in docs Construction from class method just works.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1912 +/- ##
=======================================
Coverage 95.74% 95.75%
=======================================
Files 29 29
Lines 7827 7845 +18
Branches 1179 1179
=======================================
+ Hits 7494 7512 +18
Misses 192 192
Partials 141 141 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Joschua-Conrad , I like the thorough commenting. I asked a question and made a couple inline suggestions, but otherwise it looks good.
Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
Thank you for the review and for fixing my spelling mistakes! |
First of all: I love working with CQ, thank you for maintaining this library!
Plane supports conversion between local/global coordinate systems, and Location supports chaining coordinate-system offsets.
So I from time to time want to convert between them.
However, while there is a
Location.__init__fromPlaneand aLocation.planeproperty, I did not find an implementation of the opposite conversion.This PR adds this conversion from
LocationtoPlane.Some things I ask the reviewers to notice and possibly discuss:
@multimethodonPlane.__init__. But that then disallows passing keyword arguments to the constructor, and that is needed in existing code. Using@multidispatchproduces working code, but Sphinx docs do not support it. So I leftPlane.__init__untouched and added aPlane.fromLocationclass-method.Location.planeproperty I added is analogous toPlane.location.Planeand then runs through a chain of conversions Plane -> Location -> Plane -> Location. In the end, there are two Planes and two Locations, which have to be equal, respectively. This is asserted, along with origin and rotations of the first created Location.I'm excited about your feedback!